package com.hcg.mybatis.controller;

import com.hcg.mybatis.domain.User;
import com.hcg.mybatis.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class UserController {

    @Autowired
    private UserService userService;

    @PostMapping("/user/save")
    public void saveUser(@RequestBody User user){
        userService.saveUser(user);
    }


    @PostMapping("/user/findById")
    public User findById(Long id){
        return userService.findById(id);
    }
}
